//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "diff.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TSystem_param *System_param;
extern PARAMETERS qw;
extern TRATATA zz;
//---------------------------------------------------------------------------
__fastcall TSystem_param::TSystem_param(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TSystem_param::FormCreate(TObject *Sender)
{
 char s[100];
 sprintf(s,"%5.12f",qw.a);
 Edit_A->Text = s;
 sprintf(s,"%5.12f",qw.b);
 Edit_B->Text = s;
 sprintf(s,"%5.12f",qw.c);
 Edit_C->Text = s;
 sprintf(s,"%5.12f",qw.d);
 Edit_D->Text = s;
 IAD->ItemIndex = qw.iotbr-1;
 IC->ItemIndex = qw.ic-1;
 ISS->ItemIndex = qw.iss-1;
 sprintf(s,"%d",qw.khag1);
 Edit_KHag1->Text = s;
 sprintf(s,"%d",qw.khag2);
 Edit_KHag2->Text = s;
 sprintf(s,"%d",qw.kh1);
 Edit_KH1->Text = s;
 sprintf(s,"%d",qw.kh2);
 Edit_KH2->Text = s;
 sprintf(s,"%d",qw.ktkb);
 Edit_KTKB->Text = s;
 sprintf(s,"%5.12f",qw.fi);
 Edit_FI->Text = s;
 sprintf(s,"%5.12f",qw.fik);
 Edit_FIK->Text = s;
 sprintf(s,"%5.12f",qw.e);
 Edit_HFI->Text = s;
 sprintf(s,"%5.12f",qw.ogr);
 Edit_OGR->Text = s;
 MMET->ItemIndex = qw.mmet-1;
 sprintf(s,"%5.12f",qw.pla);
 Edit_PLA->Text = s;
 sprintf(s,"%5.12f",qw.plb);
 Edit_PLB->Text = s;
 sprintf(s,"%5.12f",qw.tauh);
 Edit_TauH->Text = s;
 sprintf(s,"%5.12f",qw.taup);
 Edit_TauP->Text = s;
}
//---------------------------------------------------------------------------
//======================== Press OK
//---------------------------------------------------------------------------
void __fastcall TSystem_param::Button1Click(TObject *Sender)
{
 qw.a = atof(Edit_A->Text.c_str());
 qw.b = atof(Edit_B->Text.c_str());
 qw.c = atof(Edit_C->Text.c_str());
 qw.d = atof(Edit_D->Text.c_str());
 qw.iotbr = IAD->ItemIndex+1;
 qw.ic = IC->ItemIndex+1;
 qw.iss = ISS->ItemIndex+1;
 qw.khag1 = atoi(Edit_KHag1->Text.c_str());
 qw.khag2 = atoi(Edit_KHag2->Text.c_str());
 qw.kh1 = atoi(Edit_KH1->Text.c_str());
 qw.kh2 = atoi(Edit_KH2->Text.c_str());
 qw.ktkb = atoi(Edit_KTKB->Text.c_str());
 qw.fi = atof(Edit_FI->Text.c_str());
 qw.fik = atof(Edit_FIK->Text.c_str());
 qw.e = atof(Edit_HFI->Text.c_str());
 qw.ogr = atof(Edit_OGR->Text.c_str());
 qw.mmet = MMET->ItemIndex+1;
 qw.pla = atof(Edit_PLA->Text.c_str());
 qw.plb = atof(Edit_PLB->Text.c_str());
 qw.tauh = atof(Edit_TauH->Text.c_str());
 qw.taup = atof(Edit_TauP->Text.c_str());
 Close();
}
//---------------------------------------------------------------------------
//======================== Press Cancel
//---------------------------------------------------------------------------
void __fastcall TSystem_param::Button2Click(TObject *Sender)
{
 Close();
}
//---------------------------------------------------------------------------
void __fastcall TSystem_param::FormClose(TObject *Sender, TCloseAction &Action)
{
 Close();	
}
//---------------------------------------------------------------------------
